#include<bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;

string fun(ull n, ull k) {
    if(n == 1) {
        if(k == 0)
            return "0";
        else
            return "1";
    }
    if(n == 64 && k == 18446744073709551615)
        return "1000000000000000000000000000000000000000000000000000000000000000";

    if(k < (1ull << n - 1))
        return "0" + fun(n - 1, k);
    return "1" + fun(n - 1, (1ull << n) - 1 - k);
}

signed main() {
    ull n, k;
    cin >> n >> k;
    cout << fun(n, k);
    return 0;
}

